package v1

import "github.com/gin-gonic/gin"

type LoginForm struct {
	UserName   string `json:"username" binding:"required,min=3,max=7"`
	PassWord   string `json:"password" binding:"required,len=8"`
	RePassWord string `json:"re_password" binding:"required,len=8"`
}

func UserRegisterHandler(c *gin.Context) {

}

func UserLoginHandler(c *gin.Context) {
	var l LoginForm
	if err := c.ShouldBindJSON(&l); err != nil {
		c.JSON(200, gin.H{
			"code": 4001,
			"msg":  "登录失败，请检查参数",
			"err":  err.Error(),
		})
		return
	}
	c.JSON(200, gin.H{
		"code": 0,
		"msg":  "登录成功",
	})
}
